package com.contactbook.web.client.session;

import java.util.HashMap;

import java.util.Map;

import com.contactbook.web.client.dto.AccountDTO;

public class CurrentSession {
	
	private AccountDTO accountLoggedOn = null;
	
	public Map<String, Object> parameters = new HashMap<String, Object>();

	public void logon(AccountDTO account) {
		accountLoggedOn = account;
	}
	
	public void logout() {
		accountLoggedOn = null;
	}
	
	public String getLogin() {
		if (accountLoggedOn != null)
			return accountLoggedOn.getLogin();
		return "";
	}
	
	public String getPassword() {
		if (accountLoggedOn != null)
			return accountLoggedOn.getPassword();
		return "";
	}

	public boolean isLogged() {
		return (accountLoggedOn != null);
	}
	
	public AccountDTO getAccountLogged() {
		return accountLoggedOn;
	}
	
	public void clearParameter(Object key) {
		parameters.remove(key);
	}
}
